//
//  LoginView.m
//  DianDangDai
//
//  Created by bhf on 2017/12/14.
//  Copyright © 2017年 bhf. All rights reserved.
//

#import "LoginView.h"

@implementation LoginView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupViews];
    }
    return self;
}

- (void)setupViews {
    self.backgroundColor = [UIColor clearColor];
    
    UIView * view = (UIView*)[[[UIApplication sharedApplication]delegate]window];
    _shadowView = [[UIView alloc] init];
    _shadowView.frame = view.frame;
    _shadowView.backgroundColor = [UIColor blackColor];
    _shadowView.alpha = 0.6;
    
    UIView *loginView = [[UIView alloc] initWithFrame:CGRectMake(0,  view.height/3.5*2, SCREEN_WIDTH, view.height/3.5)];
    loginView.backgroundColor = [UIColor whiteColor];
    //logo
    UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo2"]];
    image.frame = CGRectMake((SCREEN_WIDTH-loginView.height)/2, 10, loginView.height, loginView.height/3);
    //小盾牌
    UIImageView *image2 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"login_icon"]];
    image2.frame = CGRectMake(10, CGRectGetMaxY(image.frame)+10, 18, 20);
    //提示
    UILabel *lab = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(image2.frame)+5, image2.y, SCREEN_WIDTH*8/10, 20)];
    lab.text = @"资金存管服务由汇付天下提供，安全保障升级";
    lab.font = [UIFont systemFontOfSize:14];
    //登录按钮
    UIButton *login = [UIButton buttonWithType:UIButtonTypeCustom];
    login.backgroundColor = [UIColor whiteColor];
    login.frame = CGRectMake(10, CGRectGetMaxY(image2.frame), 150, 30);
    [login setTitle:@"登录" forState:UIControlStateNormal];
    login.layer.cornerRadius = 15;
    login.layer.borderColor = [THE_MASS_TONE_ATTUNE CGColor];
    login.layer.borderWidth = 1;
    //注册按钮
    UIButton *registerbtn = [UIButton buttonWithType:UIButtonTypeCustom];
    registerbtn.backgroundColor = THE_MASS_TONE_ATTUNE;
    registerbtn.frame = CGRectMake(SCREEN_WIDTH-160, CGRectGetMaxY(image2.frame), 150, 30);
    [registerbtn  setTitle:@"注册" forState:UIControlStateNormal];
    registerbtn.layer.cornerRadius = 15;
    
    [self addSubview:_shadowView];
    [loginView addSubview:image];
    [loginView addSubview:image2];
    [loginView addSubview:lab];
    [loginView addSubview:login];
    [loginView addSubview:registerbtn];
    [self addSubview:loginView];
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
